<template>
	<view class="all" style="padding-bottom: 200rpx;">
		<my-tab @ontap='ontap' :data="{
		 	id:info.cur_id,
		 	type:3
		 }" :dianzan='info.collection' />
		<view class="top" :style="{	
			}">
			<u-swiper height='510' v-if='info' :list="info.details_image.split(',')" />
		</view>
		<view class="miaosha" v-if='info.pintuan==1'>
			<view class="miaosha_1">
				<text>恰同学年少</text>
				<text>邀请朋友一起参加课程</text>
			</view>
			<view class="miaosha_2" @click="submit">
				立刻开团
			</view>
		</view>
		<view class="body">
			<view class="text_1">
				<text v-if="info.location==1">￥{{info.location_price}}</text>
				<view v-else>
					<text>￥{{info.ticket_min_amount}}</text>
					<text>-</text>
					<text>￥{{info.ticket_max_amount}}</text>
				</view>
			</view>
			<view class="text_2">
				{{info.name}}
				<!-- 教育的未来前瞻【洛阳站】 -->
			</view>
			<view class="text_3">
				{{info.synopsis}}
				<!-- 幼儿教育是考研教师如果课堂纪律不好，孩子们就会相 互影响，且认为老师是不负责任。 -->
			</view>
			<view class="text_4">
				<text>{{info.study}}</text>人已报名
			</view>
			<view class="xian" />
			<view class="text_5">
				<text class="text_5_1">活动地址</text>
				<text class="text_5_2">{{info.address}}</text>
			</view>
			<view class="xian" />
			<view class="text_5">
				<text class="text_5_1">活动时间</text>
				<text class="text_5_2">{{info.activity_time}}</text>
			</view>
			<view class="xian" />
			<view class="text_6">
				<!-- 你的这些挑战，在这里都有答案 -->
			</view>
			<view class="text_7">
				<mp-html :content="info.content" />
				<!-- 幼儿教育是考研教师如果课堂纪律不好，孩子们就会相 互影响，且认为老师是不负责任。幼儿教育是考研教师 如果课堂纪律不好，孩子们就会相互影响，且认为老师 是不负责任。幼儿教育是考研教师如果课堂纪律不好，
				孩子们就会相互影响，且认为老师是不负责任。幼儿教 育是考研教师如果课堂纪律不好，孩子们就会相互影响 且认为老师是不负责任。幼儿教育是考研教师如果课堂 纪律不好，孩子们就会相互影响，且认为老师是不负责
				任。幼儿教育是考研教师如果课堂纪律不相互影响 -->
			</view>
		</view>
		<!-- <image src="https://s4.ax1x.com/2022/01/25/7HebcV.png" style="width: 100%;
		min-height: 1334rpx;
		margin-top: 20rpx;
		" /> -->
		<view>
			<!-- //出行计划 -->
			<chuxing :info="info" />
		</view>
		<view :class="{
			foot:true,
			
		}">
			<view class="foot_1">
				<image @click="index=true" :src="index?$src:$src1" style="width: 28rpx; height: 28rpx;" />
				<text style="margin-left: 10rpx;">我已同意并同意《改签及退款规则》《占位协议》</text>
			</view>
			<view class="foot_2" v-if="info.status==1">
				<text>邀请训练{{'('+info.invite_number+')'}}</text>
				<text @click="submit">立即参加</text>
			</view>
			<view @click="baoming" class="bm" v-else>
				立即报名

			</view>
		</view>
		<!-- 遮罩 -->
		<u-mask :show="show" @click="show = false" :mask-click-able='false'>
			<view class="warp">
				<view>
					<!-- 'height':type==2?'740rpx':'581rpx' -->
					<view class="rect" :style="{
						'height':type==2?'740rpx':'581rpx'
					}">
						<view v-if="type==2">
							<image src="https://s4.ax1x.com/2022/01/25/7HgDsI.png"
								style="width:618rpx ;height:386rpx;border-radius: 0rpx;" />
							<view class="rect_1">
								<text>抱歉,您还没有参加权限 请先开通</text>
								<view v-for="(item,index) in info.label" class="xianxjl">
									<text v-if="item.curriculum_type_id==1">直播</text>
									<text v-if="item.curriculum_type_id==2">精品课程</text>
									<text v-if="item.curriculum_type_id==3">线下课</text>
									<text v-if="item.curriculum_type_id==4">系列课</text>
									<text v-if="item.curriculum_type_id==5">专栏</text>
									<text>{{'《'+item.name+'》'}}</text>
								</view>

							</view>
							<image @tap.stop="tiao" src="https://s4.ax1x.com/2022/01/25/7H2Glj.png"
								style="width: 480rpx;height: 88rpx;margin-top: 90rpx;" />
						</view>
						<view class="kaituan" v-if="type==3">
							<image src="https://s4.ax1x.com/2022/01/25/7H5lt0.png"
								style="width:178rpx ;height:208rpx;border-radius: 0rpx;margin-top: 50rpx;" />
							<view class="kaituan_1">
								成功分享5人才能组队参加
							</view>
							<view class="kaituan_2">
								组队失败后退还定金
							</view>
							<view class="canjia" @click="zudui">
								立即参加
							</view>
						</view>
					</view>
					<image src="@/static/img/cc.png" @tap.stop='show=false' style="width: 44rpx;height: 44rpx;margin: auto;display: block;
					margin-top: 40rpx;" />
				</view>

			</view>
		</u-mask>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				current: 0,
				background: {
					background: 'none'
				},
				show: false,
				number: 8,
				cur_id: '',
				clientY: '0',
				type: '1', //判断权限1有2没有3开团
				showb: true,
				index: false,
			}
		},
		onPageScroll(res) {
			let h = res.scrollTop;
			if (h > this.clientY) {
				this.clientY = res.scrollTop;
				this.showb = true
			} else {
				this.clientY = res.scrollTop;
				this.showb = false
			}
		},
		onShow() {
			this.getinfo()
		},
		onLoad(e) {
			this.cur_id = e.cur_id
			this.type = e.type ? e.type : ''
		},
		methods: {
			baoming() {
				if (!this.index) {
					this.$toast('请同意须知', 0)
					return
				}
				this.show = true
				this.type = 2
				// uni.navigateTo({
				// 	url: './xzpd'

				// });
			},
			ontap() {
				this.getinfo()
			},
			getinfo() {
				this.$api('offline/offMsg', {
					cur_id: this.cur_id
				}).then(res => {
					this.info = res.data
				})
			},
			// 倒计时
			countdown() {
				if (this.number == 0) {
					this.number = 7;
					return false;
				} else {
					this.number--;
				}
				setTimeout(() => {
					this.countdown();
				}, 1000);
			},
			zudui() { //组队开团
				uni.navigateTo({
					url: './zudui'
				})
			},
			tiao() {
				if (this.type == 2) {
					this.show = false
					let a = this.info.label[0]
					this.$luyou(a.curriculum_type_id, a.id)
				}
			},
			submit() {
				if (!this.index) {
					this.$toast('请同意须知', 0)
					return
				}
				uni.navigateTo({
					url: `./xzpd?cur_id=${this.cur_id}`
				});
				// if (this.type == 2 || this.type == 3) { //|| this.type == 3
				// 	this.show = true
				// } else if (this.type == 1) {
				// 	uni.navigateTo({
				// 		url: './xzpd'

				// 	});
				// }
			},

		}
	}
</script>

<style lang="scss" scoped>
	.xianxjl {
		text:nth-of-type(1) {
			width: 100%;
			// border: 1rpx solid black;
		}
	}

	.bm {
		width: 350rpx;
		height: 88rpx;
		background: #FFD500;
		opacity: 1;
		border-radius: 44px;
		margin: 10rpx auto;
		text-align: center;
		line-height: 88rpx;
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #703F00;
		opacity: 1;
	}

	.slot-wrap {
		.fx {
			position: absolute;
			right: 30rpx;
			bottom: 15rpx;
			width: 44rpx;
			height: 44rpx;
		}

		.fx1 {
			position: absolute;
			right: 100rpx;
			bottom: 15rpx;
			width: 44rpx;
			height: 44rpx;
		}
	}

	.miaosha {
		height: 140rpx;
		background-color: #FC2053;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-left: 30rpx;
		padding-right: 30rpx;

		.miaosha_2 {
			width: 172rpx;
			height: 58rpx;
			text-align: center;
			line-height: 58rpx;
			background: #FFFFFF;
			opacity: 1;
			border-radius: 29px;
			font-size: 28rpx;
			font-family: Source Han Sans CN;
			color: #FF2424;
			opacity: 1;
		}

		.miaosha_1 {
			text:nth-of-type(1) {
				font-size: 36rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #FFFFFF;
				opacity: 1;
			}

			text:nth-of-type(2) {
				margin-top: 10rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #FFFFFF;
				opacity: 1;

			}


			text {
				display: block;
			}
		}
	}

	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
		position: relative;

		.rect {
			text-align: center;
			width: 618rpx;
			background-color: #fff;
			border-radius: 16rpx;

			.kaituan {
				.canjia {
					position: relative;
					top: 50rpx;
					width: 90%;
					margin: auto;
					height: 88rpx;
					background-color: rgb(220, 139, 19);
					line-height: 88rpx;
					text-align: center;
					border-radius: 100rpx;
					color: white;
					font-size: 28rpx;
					font-family: Source Han Sans CN;
				}

				.kaituan_1 {
					font-size: 28rpx;
					margin-top: 40rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #131314;
					opacity: 1;
				}

				.kaituan_2 {

					font-size: 28rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #131314;
					opacity: 1;
				}
			}

			.rect_1 {
				text-align: center;
				margin-top: 30rpx;

				text {
					display: block;
					font-size: 29rpx;
					font-family: Source Han Sans CN;
					color: #131314;
					font-weight: 500;
					opacity: 1;
				}

				// text:nth-of-type(1){}
				// text:nth-of-type(2){}
			}
		}
	}



	@keyframes example {
		from {
			height: 0px;
		}

		to {
			height: 188rpx;
		}
	}

	@keyframes example1 {
		from {
			height: 188rpx;
		}

		to {
			height: 0rpx;
		}
	}

	.foot1 {
		animation-name: example;
		animation-duration: 1s;
		overflow: hidden;
		height: 188rpx;
	}

	.foot2 {
		animation-name: example1;
		animation-duration: 1s;
		overflow: hidden;
		height: 0rpx;
	}

	.foot {
		height: 158rpx;
		width: 100%;
		position: fixed;
		bottom: 0;
		background-color: white;

		.foot_2 {
			position: absolute;
			bottom: 0;
			width: 100%;

			text:nth-of-type(2) {
				display: inline-block;
				text-align: center;
				line-height: 80rpx;
				width: 50%;
				height: 80rpx;
				background-color: #FF2424;
				border: none;
				font-size: 32rpx;
				color: #FFFFFF;
				font-family: Source Han Sans CN;
				opacity: 1;
			}

			text:nth-of-type(1) {
				border: none;
				display: inline-block;
				width: 50%;
				height: 80rpx;
				text-align: center;
				line-height: 80rpx;
				background-color: #FFD500;
				font-size: 32rpx;
				font-family: HarmonyOS Sans;
				font-weight: 400;
				color: #FFFFFF;
				opacity: 1;
			}
		}

		.foot_1 {
			margin-top: 20rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			text {
				font-size: 22rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #91969A;
				opacity: 1;
			}

		}
	}

	.xian {
		height: 1rpx;
		background-color: #E3E3E3;
		opacity: 1;
	}

	.all {
		.top {
			height: 510rpx;
			background-size: 100%;
			background-repeat: no-repeat;
		}

		.body {
			.text_1 {
				font-size: 36rpx;
				font-family: HarmonyOS Sans;
				font-weight: bold;
				color: #FF2424;
				opacity: 1;
			}

			.text_2 {
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #333333;
				opacity: 1;
				margin-top: 10rpx;
			}

			.text_3 {
				margin-top: 10rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #131314;
				opacity: 1;
			}

			.text_4 {
				margin-top: 10rpx;
				margin-bottom: 30rpx;

				text {
					color: #FF2424;
				}

				font-size: 24rpx;
				font-family: Source Han Sans SC;
				font-weight: 400;
				color: #131314;
				opacity: 1;
			}

			.text_5 {
				margin: 20rpx 0 20rpx 0;

				.text_5_1 {
					font-size: 28rpx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #131314;
					opacity: 1;
				}

				.text_5_2 {
					margin-left: 20rpx;
					font-size: 28rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #131314;
					opacity: 1;

				}
			}

			.text_6 {
				margin-top: 20rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #333333;
				opacity: 1;
			}

			.text_7 {
				text-align: justify;
				margin-top: 20rpx;
				font-size: 28rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #131314;
				opacity: 1;
			}

			padding: 30rpx 30rpx 0px 30rpx;
		}

	}
</style>
